package online.longzipeng.back.notify;

import io.netty.channel.Channel;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: lzp
 * @Description: 用户id 和 channel的关联关系处理
 * @Date: Created in 11:13 2022/6/6
 */
public class UserChanelRel {

    private static HashMap<Long, Channel> manage = new HashMap<>();

    public static void put(Long userId, Channel channel) {
        manage.put(userId, channel);
    }

    public static Channel get(Long userId) {
        return manage.get(userId);
    }

    public static void output() {
        for (Map.Entry<Long, Channel> entry : manage.entrySet()) {
            System.out.println("UserId:" + entry.getKey()
                    + ",ChannelId:" + entry.getValue().id().asLongText()
            );
        }
    }

}
